package com.mszlu.blog.controller;

import com.mszlu.blog.dao.pojo.Admin;
import com.mszlu.blog.service.AdminService;
import com.mszlu.blog.vo.Result;
import com.mszlu.blog.vo.params.UserPageParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Package: com.learn.blog.admin.controller
 * @ClassName: AdminController
 * @Author: 陈威
 * @CreateTime: 2021/9/14 17:19
 * @Description:
 */
@RestController
@RequestMapping("/admin")
public class AdminController {

    @Autowired
    AdminService adminService;


    //后台管理
    @PostMapping("/adminList")
    public Result userList(@RequestBody UserPageParam pageParam) {
        return adminService.adminList(pageParam);
    }
    //删除管理
    @PostMapping("/addAdmin")
    public Result addUser(@RequestBody Admin admin) {
        return adminService.addAdmin(admin);
    }
    //修改信息
    @PostMapping("/updateAdmin")
    public Result updateUser(@RequestBody Admin admin) {
        return adminService.updateAdmin(admin);
    }
    //删除信息
    @GetMapping("/deleteAdmin/{id}")
    public Result deleteUser(@PathVariable("id") Long id) {
        return adminService.deleteAdmin(id);
    }
    //重置密码
    @PostMapping("/resetPwd")
    public Result resetPwd(@RequestBody Admin admin) {
        return adminService.resetPwd(admin);
    }


}